package com.open.exam.sqlprovider;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author 奶茶
 * Created on 2017/11/9.
 */
public class ExamingProvider {

    private static Logger logger = LoggerFactory.getLogger(ExamingProvider.class);

    /**
     * 清除试卷专用 **********************************************************************************************************
     */


    public String findExamineeList(){
        StringBuilder stringBuffer = new StringBuilder();
        stringBuffer.append("SELECT c.* FROM Examinee AS c JOIN ( SELECT z.* FROM ExamineeExamPaper AS z JOIN ( SELECT x.* FROM ExamineeArrange AS x JOIN ExamingMonitor AS y ON x.ExamineeID = y.ExamineeID WHERE x.AppID = y.AppID AND x.ExamPlanInfoID = y.ExamPlanInfoID AND x.ExamSubjectID = y.ExamSubjectID AND y.SysState = 0 ) AS w ON z.ExamineeID = w.ExamineeID WHERE z.AppID = w.AppID AND z.ExamPlanInfoID = w.ExamPlanInfoID AND z.ExamSubjectID = w.ExamSubjectID ) AS d ON c.ExamineeID = d.ExamineeID WHERE c.AppID = d.AppID AND c.ExamPlanInfoID = d.ExamPlanInfoID");
        logger.info(stringBuffer.toString());
        return stringBuffer.toString();
    }

    public String findExamineeExampapers(){
        StringBuilder stringBuffer = new StringBuilder();
        stringBuffer.append("SELECT z.* FROM ExamineeExamPaper AS z JOIN ( SELECT x.* FROM ExamineeArrange AS x JOIN ExamingMonitor AS y ON x.ExamineeID = y.ExamineeID WHERE x.AppID = y.AppID AND x.ExamPlanInfoID = y.ExamPlanInfoID AND x.ExamSubjectID = y.ExamSubjectID AND y.SysState = 0 ) AS w ON z.ExamineeID = w.ExamineeID WHERE z.AppID = w.AppID AND z.ExamPlanInfoID = w.ExamPlanInfoID AND z.ExamSubjectID = w.ExamSubjectID");
        logger.info(stringBuffer.toString());
        return stringBuffer.toString();
    }

    public String findExamineeExamPaperItems(){
        StringBuilder stringBuffer = new StringBuilder();
        stringBuffer.append("SELECT a.* FROM ExamineeExamPaperItem AS a JOIN ( SELECT z.* FROM ExamineeExamPaper AS z JOIN ( SELECT x.* FROM ExamineeArrange AS x JOIN ExamingMonitor AS y ON x.ExamineeID = y.ExamineeID WHERE x.AppID = y.AppID AND x.ExamPlanInfoID = y.ExamPlanInfoID AND x.ExamSubjectID = y.ExamSubjectID AND y.SysState = 0 ) AS w ON z.ExamineeID = w.ExamineeID WHERE z.AppID = w.AppID AND z.ExamPlanInfoID = w.ExamPlanInfoID AND z.ExamSubjectID = w.ExamSubjectID ) AS b ON a.ExamPaperInfoID = b.ExamPaperInfoID");
        logger.info(stringBuffer.toString());
        return stringBuffer.toString();
    }

    /**
     * 清除试卷结束******************************************************************************************************
     */


    public static void main(String[] args){
//        String examineeList = findExamineeList();
//        System.out.println(examineeList);
    }
}
